<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%> 
<html>
	<head>
		<title>员工管理</title>
		<%@ include file="/pages/safeai/jsp/common/meta.jsp"%>
		<link href="${ctx}/css/safeai/together.css" rel="stylesheet" type="text/css">
	    <style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
        </style>
</head>
	<body>
		<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%>
		<form action="${ctx}/operator.do?method=addOperator" method="post" name="operatorForm">
			 <TABLE width="450px" align="center"> 
             	<tr>
                	<th colspan="2" height="25px">员工管理</th>
                </tr>
				<tr>
					<td class="td_01" width="130px">用户名：</td>
			      <td class="td_04"><input type="text" size="20" id="userid" maxlength="10" name="operator.userid"/><span class="STYLE1">*</span></td> 
				</tr>
				<tr>
					<td class="td_01">密&nbsp;&nbsp;&nbsp;&nbsp;码：</td>
					<td class="td_04"><input type="text" id="passwd" maxlength="20" name="operator.passwd"/><span class="STYLE1">*</span></td> 
				</tr>
				<tr>
					<td class="td_01">姓&nbsp;&nbsp;&nbsp;&nbsp;名：</td>
					<td  class="td_04"><input type="text" id="username" maxlength="10"  name="operator.username"/><span class="STYLE1">*</span></td> 
				</tr>
				<tr>
					<td class="td_01">角&nbsp;&nbsp;&nbsp;&nbsp;色：</td>
					<td class="td_04">
						<select name="operator.roleid">*
							<logic:iterate id="role" name="roleList">
								<option value="<bean:write name="role" property="roleid"/>"><bean:write name="role" property="rolename"/></option>
							</logic:iterate>
						</select>
					</td> 
				</tr>
				<tr>
					<td class="td_01">邮&nbsp;&nbsp;&nbsp;&nbsp;箱：</td>
					<td class="td_04"><input type="text" name="operator.mail" maxlength="30"/></td> 
				</tr>
				<tr>
					<td class="td_01">电&nbsp;&nbsp;&nbsp;&nbsp;话：</td>
					<td class="td_04"><input type="text" name="operator.phone" maxlength="15"/></td> 
				</tr>
				<tr>
					<td class="td_01">状&nbsp;&nbsp;&nbsp;&nbsp;态：</td>
					<td class="td_04"><input type="radio" name="operator.ostate" value="0" checked>正常<input type="radio" name="operator.ostate" value="1">不可用</td> 
				</tr>
				
				<tr>
            		<td colspan="2" align="center"><span style="font-family:'宋体'; font-size:12px; color:#FF0000">${operMsg}</span></td>
       			</tr>
				<tr> 
					<td colspan="2" align="center"><input type="submit" class="btn" value="添加" onclick="return sub();"/></td>
				</tr>
			</table>
		</form> 
	</body>
</html>
<script language="javascript"> 
	function isCnAndEnAndNumber(str){   
		var pattern_cn = /^([\uFE30-\uFFA0]|[_\a-zA-Z0-9]|[\s])*$/gi;
		if(pattern_cn.test(str)){ 
	    	return true;    
	    }else{     
        	return false;   
        }
     }
	function sub(){
		 var userid = window.operatorForm.userid.value;
		 var passwd = window.operatorForm.passwd.value;
		 var username = window.operatorForm.username.value;
		 if(!isCnAndEnAndNumber(userid)){
		 	alert("用户名只能由英文字母数字下划线组成！");
		 	return false;
		 }
		 if(userid.indexOf(" ")!=-1){
		 	alert("用户名中不能包含空格!");
		 	return false;
		 }
		 if(userid == null || userid == ""){
		 	alert("请输入用户名!");
		 	window.operatorForm.userid.focus();
		 	return false;
		 }
		 if(!isCnAndEnAndNumber(passwd)){
		 	alert("密码只能由英文字母数字下划线组成！");
		 	return false;
		 }
		 if(passwd.indexOf(" ")!=-1){
		 	alert("密码中不能包含字空格!");
		 	return false;
		 }
		 if(passwd == null || passwd == ""){
		 	alert("请输入密码!");
		 	window.operatorForm.passwd.focus();
		 	return false;
		 }
		 if(username.indexOf(" ")!=-1){
		 	alert("姓名中不能包含空格!");
		 	return false;
		 }
		 if(username == null || username == ""){
		 	alert("请输入姓名!");
		 	window.operatorForm.username.focus();
		 	return false;
		 }
	}
</script>